#include "Resegup_Dialog.h"

enum FeedIds
{
	TIMER_ID = 3000
};

BEGIN_EVENT_TABLE( Resegup_Dialog, wxDialog )
	EVT_TIMER(TIMER_ID,Resegup_Dialog::TimerFunc)
	EVT_CHOICE(wxID_CHOICE,Resegup_Dialog::ChoiceChange)
END_EVENT_TABLE()

Resegup_Dialog::Resegup_Dialog(wxWindow *parent, SQLINTEGER *ID_run) : ResegUP_Dialog(parent)
{
	ID = ID_run;
	//Timer.SetOwner (this, TIMER_ID);
	//Timer.Start(300);
}

Resegup_Dialog::~Resegup_Dialog(void)
{

}

void Resegup_Dialog::TimerFunc(wxTimerEvent& Event )
{
	wxString read = wxID_Runner->GetString(wxID_Runner->GetCurrentSelection());
	SQLINTEGER *ReadID = new SQLINTEGER;
	read.ToLong((SQLINTEGER*)ReadID);
	if (*ReadID != *ID)
	{
		*ID = *ReadID;
	}
	
}

void Resegup_Dialog::SetIDList(int *ID_List, int ID_Len)
{
	for (int i=0;i<ID_Len;i++)
	{
		this->wxID_Runner->Append(wxString::Format(wxT("%d"),ID_List[i]));
	}
	this->wxID_Runner->SetSelection(0);
	this->Layout();
	*ID = (SQLINTEGER)ID_List[0];
}

void Resegup_Dialog::ChoiceChange(wxCommandEvent& event)
{
	wxString Choice = wxID_Runner->GetString(wxID_Runner->GetCurrentSelection());
	Choice.ToLong((SQLINTEGER*)ID);
}